Skip to content

Report the Apple silicon GPU under Asahi Linux - #116

Open
nadalbatle wants to merge 1 commit into
HANCORE-linux:mainfrom
nadalbatle:asahi-gpu-probe
Open

nadalbatle wants to merge 1 commit into
HANCORE-linux:mainfrom
nadalbatle:asahi-gpu-probe

Conversation

@nadalbatle

Copy link
Copy Markdown

Summary

On Apple silicon running Asahi Linux, the GPU telemetry shows no GPU. The Apple GPU is a DRM platform device (/sys/class/drm/card0/device -> /sys/devices/platform/soc/206400000.gpu), so probe_drm drops it at the PCI-slot check. It also has no gpu_busy_percent. Instead it exposes:

  • agx_stats, with cumulative busy_ns (plus jobs, pstate, power_mw)
  • gpu_memory, with user_resident, kernel_resident and limit in bytes

This PR adds probe_agx to hancore.shibumi.cpu/scripts/shibumi-gpu-probe:

  • Utilization: the busy_ns delta divided by the wall-clock delta since the previous call. The previous sample is kept in a per-card state file in $XDG_RUNTIME_DIR, overridable with SHIBUMI_GPU_STATE_DIR, and SHIBUMI_GPU_NOW_NS makes it testable. The first call reads 0.
  • Memory: used is user_resident + kernel_resident, total is limit, both in MiB.
  • Temperature: stays 0, because the SMC exposes no GPU temperature.
  • ID: the device id is platform:<device>, for example platform:206400000.gpu, and the name is Apple GPU. The existing records, and NVIDIA/PCI DRM devices, are unchanged.

Affected plugins

  • hancore.shibumi.cpu (GPU probe helper), which hancore.shibumi.gpu and hancore.shibumi.telemetry consume

Checks

  • tests/gpu-probe-regression.sh passes. It includes a new Apple GPU case: a platform device fixture, a first sample at 0 %, then a 50 % busy-time delta, memory 3072/8192 MiB, and the device reported once.
  • I ran it on real hardware (iMac M1, Asahi, driver reported as aurora). Three samples at 1.5 s, the telemetry interval:
    device|platform:206400000.gpu|sysfs|24|0|3687|10276|Apple GPU|aurora||card0
    device|platform:206400000.gpu|sysfs|24|0|3685|10276|Apple GPU|aurora||card0
    device|platform:206400000.gpu|sysfs|23|0|3686|10276|Apple GPU|aurora||card0
    
  • OMARCHY_PATH=/usr/share/omarchy ./tests/contract-regression.sh stops early on my machine with Omarchy baseline inventory count drift: shell expected 320, got 356. The cause is the host: I run the omarchy-dev (edge) package, not the pinned 4.5.0-3, so it is unrelated to this change. I could not run the full contract against the pinned baseline.

Remaining gate

I have not checked the visible GPU card and panel on a live Shibumi session yet; that will follow once I have Shibumi installed on this machine. Nothing in QML changed. GpuPanel.qml already falls back to showing the raw id for non-pci: ids.

🤖 Generated with Claude Code

The GPU probe skipped every DRM device that is not on PCI, so the Apple
GPU on Asahi (a platform device with no gpu_busy_percent) was never
reported. Add probe_agx: it reads cumulative busy time from agx_stats
and turns the delta since the previous call into a utilization, and
reads resident and limit memory from gpu_memory. Temperature stays 0,
as the SMC exposes no GPU temperature.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants